package com.hdax.dmw.scheduler.api;

import com.hdax.dmw.common.utils.Result;
import com.hdax.dmw.scheduler.dtos.SchedulerDto;
import com.hdax.dmw.scheduler.dtos.SeatArrayDto;
import com.hdax.dmw.scheduler.service.SchedulerSeatPriceService;
import com.hdax.dmw.scheduler.service.SchedulerSeatService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@RestController
@RequestMapping(path = "/choose/seat/")
public class SchedulerApi {

    @Autowired
    private SchedulerSeatPriceService priceService;
    @Autowired
    private SchedulerSeatService seatService;

    @PostMapping(path = "/getSchedule")
    public Result<SchedulerDto> getSchedule(@RequestBody Map<String,Long> params){
        Long scheduleId = params.get("scheduleId");
        return priceService.getSchedule(scheduleId);
    }

    @PostMapping(path = "/getSeatList")
    public Result<SeatArrayDto> getSeatList(@RequestBody Map<String,Long> params){
        Long scheduleId = params.get("scheduleId");
        return seatService.seatArray(scheduleId);
    }
}
